package com.study.design.pattern.pattern.behavioral.observer.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author: gongsl
 * @Date: 2025-03-23 23:53
 */
@Component
public class ObserverPatternTest implements CommandLineRunner {

    @Autowired
    private WeatherStation weatherStation;
    @Autowired
    private StockMarket stockMarket;

    @Override
    public void run(String... args) throws Exception {
        System.out.println("启动测试观察者模式");
        weatherStation.setTemperature(28.5);
        stockMarket.setStockPrice(150.75);
    }
}
